package com.shipwe.loans.configs

import com.shipwe.language.LocaleContract
import com.shipwe.language.ShipweLanguages
import com.shipwe.loans.MyApps
import com.shipwe.loans.utils.shared.ShipweSharedHelper
import com.shipwe.loans.utils.shared.ShipweSharedKey

/**
 * Shipwe
 * @Author wwdeng
 * @CreateTime: 2024/11/18 10:59
 * @Annotation：APP 配置
 */
object ShipweConfigs {

    /**
     * APP 名称
     */
    const val SHIPWE_APPNAME = "SHIPWELOANS"

    /**
     * 包名
     */
    const val SHIPWE_PACKAGENANME = "com.Shipweloans.credit.onlineloan"

    /**
     * 加解密
     */
//    const val SHIPWE_AES_KEY = "oAgEL6ij5yIJFIQa"
//    const val SHIPWE_AES_IV = "tlt0ECkaUg5WVaGP"

    /**
     * Adjust
     */
    const val SHIPWE_ADJ_TOKEN = "se1hrl6xuakg"
    const val SHIPWE_ADJ_EVENT_REGISTER = "j3zo8z"
    const val SHIPWE_ADJ_EVENT_APPLY = "jv8iz6"

    /**
     * 获取加解密Key
     */
    fun getSecretKey(): String{
        return ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_SECRET_KEY)
    }

    /**
     * 获取加解密IV
     */
    fun getSecretIv(): String{
        return ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_SECRET_IV)
    }

    /**
     * 是否是法语地区
     *  desc：地区转发（timeZone） 以 fcfa、xaf、senegal、benin 结尾，则定义为法语地区
     */
    fun isFrench(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("fcfa") || timeZone.endsWith("xaf") || timeZone.endsWith("senegal") || timeZone.endsWith("benin")
    }

    /**
     * 加纳 233
     */
    fun isGha(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("gha")
    }

    /**
     * 肯尼亚 254
     */
    fun isKsh(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("ksh")
    }

    /**
     * 乌干达 256
     */
    fun isUgx(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("ugx")
    }

    /**
     * 科特迪瓦 225
     */
    fun isFcfa(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("fcfa")
    }

    /**
     * 喀麦隆  237
     */
    fun isXaf(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("xaf")
    }

    /**
     * 赞比亚 	260
     */
    fun isZmb(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("zmb")
    }

    /**
     * 塞内加尔  221
     */
    fun isSenegal(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("senegal")
    }

    /**
     * 坦桑尼亚  255
     */
    fun isTanz(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("tanz")
    }

    /**
     * 贝宁  229
     */
    fun isBenin(): Boolean{
        val timeZone = ShipweSharedHelper.getShipweSharedString(ShipweSharedKey.SHIPWE_TIMEZONE)
        return timeZone.endsWith("benin")
    }

    /**
     * 是否是斯瓦西里语
     */
    fun isSwahili(): Boolean{
        if (isTanz()) {
            val curtLocale = ShipweLanguages.getAppLanguage(MyApps.app.getAppContext())
            when (curtLocale.language) {
                LocaleContract.getSwahiliLocale().language -> {//坦桑
                    return true
                }
            }
        }
        return false
    }

}